package lcr;

public class Test0179 {
}

class Solution0179 {
    public int[] twoSum(int[] price, int target) {
        int length = price.length;
        int l=0,r = length-1;
        while (l<r){
            int sum = price[l]+price[r];
            if (sum==target){
                return new int[]{price[l],price[r]};
            }else if (sum<target){
                l++;
            }else {
                r--;
            }
        }

        return new int[]{-1,-1};
    }
}